home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / A3DEV.ZIP / AFD.H next >
Encoding:
C/C++ Source or Header  |  1996-11-22  |  1.8 KB  |  59 lines

  1.  
  2. #include <tos.h>
  3.  
  4. void *Alphabase(void);
  5.  
  6. /* #define Alphabase() _pxv(2001) */
  7.  
  8. #define trap_3_w(n)                            \
  9. __extension__                                \
  10. ({                                    \
  11.     register long retvalue __asm__("d0");                \
  12.                                         \
  13.     __asm__ volatile                        \
  14.     ("\
  15.         movw    %1,sp@-; \
  16.         trap    #3;    \
  17.         addqw   #2,sp "                        \
  18.     : "=r"(retvalue)            /* outputs */        \
  19.     : "g"(n)                /* inputs  */        \
  20.     : "d0", "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */    \
  21.       AND_MEMORY                            \
  22.     );                                \
  23.     retvalue;                            \
  24. })
  25.  
  26. #define Alphabase() (void *)trap_3_w((short)(0x7D1))
  27.  
  28. typedef char gp1k[1024];
  29. typedef unsigned short uint;
  30. typedef unsigned long ulong;
  31.  
  32. struct alpha
  33. {
  34. void    *afd_malloc;        /* Apex Malloc routine (in) */
  35. void    *afd_dealloc;        /* Apex Mfree routine (in) */
  36. void    *afd_salloc;        /* Apex stacked malloc routine */
  37. void    *afd_thread;        /* Apex background thread (in) */
  38. void    *afd_open;        /* Fopen (in) */
  39. void    *afd_close;        /* Fclose (in) */
  40. void    *afd_create;        /* Fcreate (in) */
  41. void    *afd_read;        /* Fread (in) */
  42. void    *afd_write;        /* Fwrite (in) */
  43. void    *afd_seek;        /* Fseek (in) */
  44. void    *afd_examine;        /* Fseek + Fread (in) */
  45. void    *afd_patch;        /* Fseek + Fwrite (in) */
  46. char    *afd_extension;        /* pointer to format extension string (out) */
  47. void    *afd_inquire;        /* format inquire routine address (out) */
  48. void    *afd_decode;        /* format decoder routine address (out) */
  49. void    *afd_encode;        /* format encoder routine address (out) */
  50. uint    afd_colour;        /* format highlight colour (out) */
  51. uint    afd_id;            /* format id (out) */
  52. uint    afd_width;        /* image width (in/out) */
  53. uint    afd_height;        /* image height (in/out) */
  54. void    *afd_imageptr;        /* 32bit imagebuffer pointer (in) */
  55. ulong    afd_filesize;        /* file size in bytes (in) */
  56. gp1k    afd_filename;        /* 1k filename string buffer (in) */
  57. gp1k    afd_gpbuffer;        /* 1k general purpose buffer (in) */
  58. };
  59.